<template>
    <div v-html="formatText" :style="`line-height: ${props.lineHeight}rem;`"></div>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps(['content','lineHeight']);  // 接收父组件传参

const formatText = computed(() => {
    return props.content
    .split('\n')
    .map(line => line.replace(/ /g, '&nbsp;'))
    .join('<br>');
});
</script>
<style scoped></style>